package com.boost.network;

import java.net.InetAddress;

public class InetAddressTest {
    public static void main(String[] args) throws Exception {
        //根据主机名来获取对应的 InetAddress 实例
        InetAddress ip = InetAddress.getByName("www.baidu.com");
        //判断是否可以抵达
        System.out.println("crazyit 是否可达:"+ ip.isReachable(2000));
        //获取InetAddress 实例的IP字符串
        System.out.println(ip.getHostAddress());
    }
}
